//-----------------------------------------------------------------------
// <copyright file="TurnoverService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class TurnoverService
    {
        #region Turnover

        public static void CreateTurnover(Turnover turnover)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                turnoverDAO.CreateTurnover(turnover);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateTurnoverException, ex);
            }
        }        

        public static void UpdateTurnover(Turnover turnover)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                turnoverDAO.UpdateTurnover(turnover);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateTurnoverException, ex);
            }
        }        

        public static void DeleteTurnover(int turnoverID)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                turnoverDAO.DeleteTurnover(turnoverID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteTurnoverException, ex);
            }
        }
        
        public static Turnover GetTurnover(int turnoverID)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                return turnoverDAO.GetTurnover(turnoverID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTurnoverException, ex);
            }
        }                

        public static TurnoverCollection GetTurnoverList(TurnoverColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                return turnoverDAO.GetTurnoverList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTurnoverListException, ex);
            }
        }        

        public static TurnoverCollection GetTurnoverList(TurnoverColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                return turnoverDAO.GetTurnoverList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTurnoverListException, ex);
            }
        }        

	    public static TurnoverCollection GetTurnoverListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                return turnoverDAO.GetTurnoverListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTurnoverListException, ex);
            }
        }        

        public static TurnoverCollection GetTurnoverListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                TurnoverDAO turnoverDAO = new TurnoverDAO();
                return turnoverDAO.GetTurnoverListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetTurnoverListException, ex);
            }
        }        

        #endregion
    }
}